home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PAS_0793 / FINDBOOL.TXT < prev    next >
Text File  |  1993-08-01  |  2KB  |  36 lines

  1. ─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 404 of 417                                                               
  3. From : Rob Perelman                        1:202/1308.0         06 Jul 93  07:33 
  4. To   : All                                                                       
  5. Subj : Modifying EXE code                                                     
  6. ────────────────────────────────────────────────────────────────────────────────
  7. With all this talk about self modifying EXE code, I decided to try it
  8. for myself.  I found a file that is supposed to change an EXE, but it
  9. was too complicated for me.  For those of you people who want to try out
  10. self-modifying EXE code, check out this program I wrote.  I call it
  11. FINDBOOL, because guess what it does?  It finds a boolean!  See, you
  12. make a CONST at the top of your program called REGISTERED or something,
  13. and set it to FALSE.  Then compile it.  Then edit it and change it to
  14. TRUE.  Then compile it under a different name.  Then run my program
  15. (FINDBOOL) with the names of the two EXE files as parameters
  16. (ie FINDBOOL FILE1.EXE FILE2.EXE).  It will search through the two and
  17. find the boolean value.  Then it will write to a file called
  18. REGISTER.PAS, which, when applied to either EXE, it will go to the
  19. location of the boolean (found from both the EXEs) and toggle the
  20. boolean (if it was FALSE, make it TRUE...or vice versa).  You can
  21. compile REGISTER.PAS and give it an EXE as a file name and it will
  22. toggle the boolean!  Pretty neat, eh?  Sorry about this gibberish I call
  23. an explanation, but it's 7am and I haven't gone to bed yet...ain't it
  24. great to be a programmer??  Well, anyway...the code is in the next
  25. message, but here is code to test my FINDBOOL.  Compile this, rename it,
  26. change the boolean, compile it again, and then run FINDBOOL.  Oh, by the
  27. way, FINDBOOL works with OVRs, too...so you overlay users, don't fret :)
  28.  
  29. Program Test;
  30.  
  31. Const Registered=False;
  32.  
  33. Begin
  34.   If Registered then Writeln('Thank you for registering!')
  35.                 Else Writeln('Please register!');
  36. End.